<template>
    <div>
      <div>
        <van-nav-bar :title="$store.state.phoneTitle"/>
      </div>
      <div>
        <router-view/>
      </div>
      <div v-show="$store.state.phoneTitle !== '登录'">
        <van-tabbar v-model="active" @change="onChange">
          <van-tabbar-item icon="home-o">首页</van-tabbar-item>
          <van-tabbar-item icon="search">播客</van-tabbar-item>
          <van-tabbar-item icon="manager-o">我的</van-tabbar-item>
          <van-tabbar-item icon="like-o">关注</van-tabbar-item>
          <van-tabbar-item icon="friends-o">社区</van-tabbar-item>
        </van-tabbar>
      </div>
    </div>
</template>

<script>
export default {
  name: "Phone",
  data(){
    return{
      active:0
    }
  },
  methods:{
    onChange(index) {
      switch (index){
        case 0:
          this.$router.push('/phone/home')
          break;
        case 1:
          this.$router.push('/phone/podcast')
          break;
        case 2:
          this.$router.push('/phone/myCenter')
          break;
      }
    },
  },
  mounted() {
    this.$store.state.phoneTitle =this.$route.meta.title
  },

}
</script>

<style scoped>

</style>